home *** CD-ROM | disk | FTP | other *** search
/ synchro.net / synchro.net.tar / synchro.net / main / GAMES / cs2d.exe / {app} / sys / lua / wrapper.lua < prev   
Encoding:
Text File  |  2011-03-25  |  13.4 KB  |  670 lines

  1. -------------------------------------------------------------------
  2. -- Wrapper functions for easy usage of CS2D commands in Lua      --
  3. -- 25.03.2011 - www.UnrealSoftware.de                            --
  4. -------------------------------------------------------------------
  5.  
  6. -------------------------------------------------------------------
  7. -- These functions make it easier to use CS2D commands in Lua    --
  8. -- They call the parse functions with the fitting parameters     --
  9. --                                                               --
  10. -- Example without wrapper function:                             --
  11. -- parse("spawnplayer "..id.." "..x.." " ..y)                    --
  12. --                                                               --
  13. -- Example with wrapper function:                                --
  14. -- spawnplayer(id,x,y)                                           --
  15. --                                                               --
  16. -- Both examples do exactly the same but using the wrapper       --
  17. -- function is much easier and not as error-prone as using parse.--
  18. -- Therefore it is recommended to use the wrapper functions.     --
  19. --                                                               --
  20. -- Use the following line to include the wrapper in your script: --
  21. -- if wrapper~=TRUE then dofile("sys/lua/wrapper.lua") end       --
  22. -------------------------------------------------------------------
  23.  
  24. -- Set Wrapper state to LOADED/TRUE!
  25. wrapper=TRUE
  26.  
  27. -- Functions
  28. function bot_add()
  29.     parse("bot_add")
  30. end
  31.  
  32. function bot_add_ct()
  33.     parse("bot_add_ct")
  34. end
  35.  
  36. function bot_add_t()
  37.     parse("bot_add_t")
  38. end
  39.  
  40. function bot_count(count)
  41.     parse("bot_count "..count)
  42. end
  43.  
  44. function bot_jointeam(team)
  45.     parse("bot_jointeam "..team)
  46. end
  47.  
  48. function bot_kill()
  49.     parse("bot_kill")
  50. end
  51.  
  52. function bot_prefix(prefix)
  53.     parse("bot_prefix "..prefix)
  54. end
  55.  
  56. function bot_remove()
  57.     parse("bot_remove")
  58. end
  59.  
  60. function bot_remove_all()
  61.     parse("bot_remove_all")
  62. end
  63.  
  64. function bot_remove_ct()
  65.     parse("bot_remove_ct")
  66. end
  67.  
  68. function bot_remove_t()
  69.     parse("bot_remove_t")
  70. end
  71.  
  72. function bot_skill(skill)
  73.     parse("bot_skill "..skill)
  74. end
  75.  
  76. function bot_weapons(weapons)
  77.     parse("bot_weapons "..weapons)
  78. end
  79.  
  80. function changelevel(map)
  81.     parse("changelevel "..map)
  82. end
  83.  
  84. function changemap(map)
  85.     parse("changemap "..map)
  86. end
  87.  
  88. function customkill(killer,weaponname,victim)
  89.     parse("customkill "..killer.." "..weaponname.." "..victim)
  90. end
  91.  
  92. function deathslap(player)
  93.     parse("deathslap "..player)
  94. end
  95.  
  96. function effect(effect,x,y,p1,p2,r,g,b)
  97.     parse("effect "..effect.." "..x.." "..y.." "..p1.." "..p2.." "..r.." "..g.." "..b)
  98. end
  99.  
  100. function equip(player,weapon)
  101.     parse("equip "..player.." "..weapon)
  102. end
  103.  
  104. function explosion(x,y,size,damage,sourceplayer)
  105.     parse("explosion "..x.." "..y.." "..size.." "..damage.." "..sourceplayer)
  106. end
  107.  
  108. function flashplayer(player,intensity)
  109.     parse("flashplayer "..player.." "..intensity)
  110. end
  111.  
  112. function flashposition(x,y,intensity)
  113.     parse("flashposition "..x.." "..y.." "..intensity)
  114. end
  115.  
  116. function hudtxt(id,text,x,y,align)
  117.     parse("hudtxt "..id.." "..text.." "..x.." "..y.." "..align)
  118. end
  119.  
  120. function hudtxt2(player,id,text,x,y,align)
  121.     parse("hudtxt2 "..player.." "..id.." "..text.." "..x.." "..y.." "..align)
  122. end
  123.  
  124. function hudtxtalphafade(player,id,duration,alpha)
  125.     parse("hudtxtalphafade "..player.." "..id.." "..duration.." "..alpha)
  126. end
  127.  
  128. function hudtxtcolorfade(player,id,duration,red,green,blue)
  129.     parse("hudtxtcolorfade "..player.." "..id.." "..duration.." "..red.." "..green.." "..blue)
  130. end
  131.  
  132. function hudtxtmove(player,id,duration,x,x)
  133.     parse("hudtxtmove "..player.." "..id.." "..duration.." "..x.." "..x)
  134. end
  135.  
  136. function items()
  137.     parse("items")
  138. end
  139.  
  140. function kick(player,reason)
  141.     parse("kick "..player.." "..reason)
  142. end
  143.  
  144. function killobject(objectid)
  145.     parse("killobject "..objectid)
  146. end
  147.  
  148. function killplayer(player)
  149.     parse("killplayer "..player)
  150. end
  151.  
  152. function listbans()
  153.     parse("listbans")
  154. end
  155.  
  156. function listplayers()
  157.     parse("listplayers")
  158. end
  159.  
  160. function logaddress_add(address)
  161.     parse("logaddress_add "..address)
  162. end
  163.  
  164. function logaddress_remove(address)
  165.     parse("logaddress_remove "..address)
  166. end
  167.  
  168. function logaddress_removeall()
  169.     parse("logaddress_removeall")
  170. end
  171.  
  172. function lua(script)
  173.     parse("lua "..script)
  174. end
  175.  
  176. function luareset()
  177.     parse("luareset")
  178. end
  179.  
  180. function makect(player)
  181.     parse("makect "..player)
  182. end
  183.  
  184. function makespec(player)
  185.     parse("makespec "..player)
  186. end
  187.  
  188. function maket(player)
  189.     parse("maket "..player)
  190. end
  191.  
  192. function map(map)
  193.     parse("map "..map)
  194. end
  195.  
  196. function maps()
  197.     parse("maps")
  198. end
  199.  
  200. function mp_antispeeder(antispeederprotection)
  201.     parse("mp_antispeeder "..antispeederprotection)
  202. end
  203.  
  204. function mp_autogamemode(autogamemode)
  205.     parse("mp_autogamemode "..autogamemode)
  206. end
  207.  
  208. function mp_autoteambalance(balance)
  209.     parse("mp_autoteambalance "..balance)
  210. end
  211.  
  212. function mp_building_health(building,price)
  213.     parse("mp_building_health "..building.." "..price)
  214. end
  215.  
  216. function mp_building_limit(building,limit)
  217.     parse("mp_building_limit "..building.." "..limit)
  218. end
  219.  
  220. function mp_building_price(building,price)
  221.     parse("mp_building_price "..building.." "..price)
  222. end
  223.  
  224. function mp_buytime(_time)
  225.     parse("mp_buytime ".._time)
  226. end
  227.  
  228. function mp_c4timer(_time)
  229.     parse("mp_c4timer ".._time)
  230. end
  231.  
  232. function mp_curtailedexplosions(curtailed)
  233.     parse("mp_curtailedexplosions "..curtailed)
  234. end
  235.  
  236. function mp_damagefactor(factor)
  237.     parse("mp_damagefactor "..factor)
  238. end
  239.  
  240. function mp_deathdrop(drop)
  241.     parse("mp_deathdrop "..drop)
  242. end
  243.  
  244. function mp_dispenser_health(health)
  245.     parse("mp_dispenser_health "..health)
  246. end
  247.  
  248. function mp_dispenser_money(money)
  249.     parse("mp_dispenser_money "..money)
  250. end
  251.  
  252. function mp_dmspawnmoney(money)
  253.     parse("mp_dmspawnmoney "..money)
  254. end
  255.  
  256. function mp_dropgrenades(drop)
  257.     parse("mp_dropgrenades "..drop)
  258. end
  259.  
  260. function mp_floodprot(floodprotection)
  261.     parse("mp_floodprot "..floodprotection)
  262. end
  263.  
  264. function mp_freezetime(_time)
  265.     parse("mp_freezetime ".._time)
  266. end
  267.  
  268. function mp_grenaderebuy(allowed)
  269.     parse("mp_grenaderebuy "..allowed)
  270. end
  271.  
  272. function mp_hostagepenalty(kills)
  273.     parse("mp_hostagepenalty "..kills)
  274. end
  275.  
  276. function mp_idleaction(action)
  277.     parse("mp_idleaction "..action)
  278. end
  279.  
  280. function mp_idlekick(idleaction)
  281.     parse("mp_idlekick "..idleaction)
  282. end
  283.  
  284. function mp_idletime(_time)
  285.     parse("mp_idletime ".._time)
  286. end
  287.  
  288. function mp_infammo(infiniteammo)
  289.     parse("mp_infammo "..infiniteammo)
  290. end
  291.  
  292. function mp_kevlar(percent)
  293.     parse("mp_kevlar "..percent)
  294. end
  295.  
  296. function mp_kickpercent(percent)
  297.     parse("mp_kickpercent "..percent)
  298. end
  299.  
  300. function mp_killbuildingmoney(money)
  301.     parse("mp_killbuildingmoney "..money)
  302. end
  303.  
  304. function mp_killbuildings(kill)
  305.     parse("mp_killbuildings "..kill)
  306. end
  307.  
  308. function mp_killinfo(info)
  309.     parse("mp_killinfo "..info)
  310. end
  311.  
  312. function mp_killteambuildings(mode)
  313.     parse("mp_killteambuildings "..mode)
  314. end
  315.  
  316. function mp_lagcompensation(maxcompensationtime)
  317.     parse("mp_lagcompensation "..maxcompensationtime)
  318. end
  319.  
  320. function mp_localrconoutput(output)
  321.     parse("mp_localrconoutput "..output)
  322. end
  323.  
  324. function mp_luamap(use)
  325.     parse("mp_luamap "..use)
  326. end
  327.  
  328. function mp_luaserver(file)
  329.     parse("mp_luaserver "..file)
  330. end
  331.  
  332. function mp_mapgoalscore(score)
  333.     parse("mp_mapgoalscore "..score)
  334. end
  335.  
  336. function mp_mapvoteratio(percent)
  337.     parse("mp_mapvoteratio "..percent)
  338. end
  339.  
  340. function mp_maxclientsip(clients)
  341.     parse("mp_maxclientsip "..clients)
  342. end
  343.  
  344. function mp_maxrconfails(maxfails)
  345.     parse("mp_maxrconfails "..maxfails)
  346. end
  347.  
  348. function mp_natholepunching(allowpunching)
  349.     parse("mp_natholepunching "..allowpunching)
  350. end
  351.  
  352. function mp_pinglimit(limit)
  353.     parse("mp_pinglimit "..limit)
  354. end
  355.  
  356. function mp_radar(radar)
  357.     parse("mp_radar "..radar)
  358. end
  359.  
  360. function mp_randomspawn(_random)
  361.     parse("mp_randomspawn ".._random)
  362. end
  363.  
  364. function mp_reservations(reservations)
  365.     parse("mp_reservations "..reservations)
  366. end
  367.  
  368. function mp_respawndelay(delay)
  369.     parse("mp_respawndelay "..delay)
  370. end
  371.  
  372. function mp_roundlimit(rounds)
  373.     parse("mp_roundlimit "..rounds)
  374. end
  375.  
  376. function mp_roundtime(_time)
  377.     parse("mp_roundtime ".._time)
  378. end
  379.  
  380. function mp_startmoney(money)
  381.     parse("mp_startmoney "..money)
  382. end
  383.  
  384. function mp_supply_items(itemlist)
  385.     parse("mp_supply_items "..itemlist)
  386. end
  387.  
  388. function mp_teamkillpenalty(kills)
  389.     parse("mp_teamkillpenalty "..kills)
  390. end
  391.  
  392. function mp_teleportreload(reloadtime)
  393.     parse("mp_teleportreload "..reloadtime)
  394. end
  395.  
  396. function mp_tempbantime(_time)
  397.     parse("mp_tempbantime ".._time)
  398. end
  399.  
  400. function mp_timelimit(_time)
  401.     parse("mp_timelimit ".._time)
  402. end
  403.  
  404. function mp_tkpunish(kill)
  405.     parse("mp_tkpunish "..kill)
  406. end
  407.  
  408. function mp_trace(accuracy)
  409.     parse("mp_trace ".."accuracy")
  410. end
  411.  
  412. function mp_turretdamage(damage)
  413.     parse("mp_turretdamage "..damage)
  414. end
  415.  
  416. function mp_unbuildable(buildings)
  417.     parse("mp_unbuildable "..buildings)
  418. end
  419.  
  420. function mp_unbuyable(unbuyable)
  421.     parse("mp_unbuyable "..unbuyable)
  422. end
  423.  
  424. function mp_vulnerablehostages(vulnerable)
  425.     parse("mp_vulnerablehostages "..vulnerable)
  426. end
  427.  
  428. function mp_winlimit(wins)
  429.     parse("mp_winlimit "..wins)
  430. end
  431.  
  432. function mp_wpndmg(name,damage)
  433.     parse("mp_wpndmg "..name.." "..damage)
  434. end
  435.  
  436. function mp_wpndmg_z1(name,damage)
  437.     parse("mp_wpndmg_z1 "..name.." "..damage)
  438. end
  439.  
  440. function mp_wpndmg_z2(name,damage)
  441.     parse("mp_wpndmg_z2 "..name.." "..damage)
  442. end
  443.  
  444. function mp_zombiedmg(percentageofdamage)
  445.     parse("mp_zombiedmg "..percentageofdamage)
  446. end
  447.  
  448. function mp_zombiekillequip(weapon)
  449.     parse("mp_zombiekillequip "..weapon)
  450. end
  451.  
  452. function mp_zombiekillscore(killscore)
  453.     parse("mp_zombiekillscore "..killscore)
  454. end
  455.  
  456. function mp_zombierecover(recover)
  457.     parse("mp_zombierecover "..recover)
  458. end
  459.  
  460. function mp_zombiespeedmod(speedmod)
  461.     parse("mp_zombiespeedmod "..speedmod)
  462. end
  463.  
  464. function msg(message)
  465.     parse("msg "..message)
  466. end
  467.  
  468. function rcon(commands)
  469.     parse("rcon "..commands)
  470. end
  471.  
  472. function rcon_password(password)
  473.     parse("rcon_password "..password)
  474. end
  475.  
  476. function rcon_pw(password)
  477.     parse("rcon_pw "..password)
  478. end
  479.  
  480. function removeitem(item)
  481.     parse("removeitem "..item)
  482. end
  483.  
  484. function reroute(player,address)
  485.     parse("reroute "..player.." "..address)
  486. end
  487.  
  488. function restart(delay)
  489.     parse("restart "..delay)
  490. end
  491.  
  492. function restartround(delay)
  493.     parse("restartround "..delay)
  494. end
  495.  
  496. function setarmor(player,armor)
  497.     parse("setarmor "..player.." "..armor)
  498. end
  499.  
  500. function setdeaths(player,deaths)
  501.     parse("setdeaths "..player.." "..deaths)
  502. end
  503.  
  504. function sethealth(player,health)
  505.     parse("sethealth "..player.." "..health)
  506. end
  507.  
  508. function setmaxhealth(player,maxhealth)
  509.     parse("setmaxhealth "..player.." "..maxhealth)
  510. end
  511.  
  512. function setmoney(player,money)
  513.     parse("setmoney "..player.." "..money)
  514. end
  515.  
  516. function setname(player,name)
  517.     parse("setname "..player.." "..name)
  518. end
  519.  
  520. function setpos(player,x,y)
  521.     parse("setpos "..player.." "..x.." "..y)
  522. end
  523.  
  524. function setscore(player,score)
  525.     parse("setscore "..player.." "..score)
  526. end
  527.  
  528. function setweapon(player,weapon)
  529.     parse("setweapon "..player.." "..weapon)
  530. end
  531.  
  532. function shake(player,power)
  533.     parse("shake "..player.." "..power)
  534. end
  535.  
  536. function slap(player)
  537.     parse("slap "..player)
  538. end
  539.  
  540. function spawnitem(item,x,y)
  541.     parse("spawnitem "..item.." "..x.." "..y)
  542. end
  543.  
  544. function spawnnpc(_type,x,y,rot)
  545.     parse("spawnnpc ".._type.." "..x.." "..y.." "..rot)
  546. end
  547.  
  548. function spawnobject(_type,x,y,rot,mode,team,player)
  549.     parse("spawnobject ".._type.." "..x.." "..y.." "..rot.." "..mode.." "..team.." "..player)
  550. end
  551.  
  552. function spawnplayer(player,x,y)
  553.     parse("spawnplayer "..player.." "..x.." "..y)
  554. end
  555.  
  556. function speedmod(player,speedmod)
  557.     parse("speedmod "..player.." "..speedmod)
  558. end
  559.  
  560. function strip(player,weapon)
  561.     parse("strip "..player.." "..weapon)
  562. end
  563.  
  564. function sv_fow(fow)
  565.     parse("sv_fow "..fow)
  566. end
  567.  
  568. function sv_friendlyfire(FF)
  569.     parse("sv_friendlyfire "..FF)
  570. end
  571.  
  572. function sv_gamemode(mode)
  573.     parse("sv_gamemode "..mode)
  574. end
  575.  
  576. function sv_gm(mode)
  577.     parse("sv_gm "..mode)
  578. end
  579.  
  580. function sv_hostport(port)
  581.     parse("sv_hostport "..port)
  582. end
  583.  
  584. function sv_lan(lan)
  585.     parse("sv_lan "..lan)
  586. end
  587.  
  588. function sv_map(map)
  589.     parse("sv_map "..map)
  590. end
  591.  
  592. function sv_maptransfer(transfer)
  593.     parse("sv_maptransfer "..transfer)
  594. end
  595.  
  596. function sv_maxplayers(players)
  597.     parse("sv_maxplayers "..players)
  598. end
  599.  
  600. function sv_msg(message)
  601.     parse("sv_msg "..message)
  602. end
  603.  
  604. function sv_msg2(player,message)
  605.     parse("sv_msg2 "..player.." "..message)
  606. end
  607.  
  608. function sv_name(name)
  609.     parse("sv_name "..name)
  610. end
  611.  
  612. function sv_password(password)
  613.     parse("sv_password "..password)
  614. end
  615.  
  616. function sv_rcon(rconpassword)
  617.     parse("sv_rcon "..rconpassword)
  618. end
  619.  
  620. function sv_restart(delay)
  621.     parse("sv_restart "..delay)
  622. end
  623.  
  624. function sv_restartround(delay)
  625.     parse("sv_restartround "..delay)
  626. end
  627.  
  628. function sv_sound(soundfile)
  629.     parse("sv_sound "..soundfile)
  630. end
  631.  
  632. function sv_sound2(player,soundfile)
  633.     parse("sv_sound2 "..player.." "..soundfile)
  634. end
  635.  
  636. function sv_specmode(mode)
  637.     parse("sv_specmode "..mode)
  638. end
  639.  
  640. function sv_spraytransfer(spraytransfer)
  641.     parse("sv_spraytransfer "..spraytransfer)
  642. end
  643.  
  644. function sv_usgnonly(usgnonly)
  645.     parse("sv_usgnonly "..usgnonly)
  646. end
  647.  
  648. function transfer_speed(speed)
  649.     parse("transfer_speed "..speed)
  650. end
  651.  
  652. function trigger(trigger)
  653.     parse("trigger "..trigger)
  654. end
  655.  
  656. function unban(banmask)
  657.     parse("unban "..banmask)
  658. end
  659.  
  660. function unbanall()
  661.     parse("unbanall")
  662. end
  663.  
  664. function usgn_addserver()
  665.     parse("usgn_addserver")
  666. end
  667.  
  668. function usgn_info()
  669.     parse("usgn_info")
  670. end